/**
 * Copyright (c) 快宝网络 kuaidihelp.com Co., Ltd. All Rights Reserved 禁止外泄以及用于其它的商业用途
 */

// eslint-disable-next-line import/no-extraneous-dependencies
import { Request, Response } from 'express';
import { responseSuccess, ResponseItem } from './utils';
import Mock from 'mockjs';
const { mock } = Mock;

export default {
  // 驿站出入库记录
  'POST /CustomerService/inboundAndOutboundRecords': (req: Request, res: Response) => {
    const result: ResponseItem = {
      code: 0,
      msg: '',
      data: Mock.mock({
        'mixed_data|10': [
          {
            'id|+1': 1,
            waybill_no: '773003552828333',
            brand: 'sto',
            operate_phone: '18829900094',
            is_upload: '否',
            upload_type: '不上传',
            upload_time: '2022-03-28 17:02:16',
            upload_result: '17:02:16盘点扫描',
            upload_base_type: '出库',
          },
        ],
        base_info: {
          topic_id: '5730246',
          sms_status: '微信已读', // 短信通知
          ivr_status: '', // 云呼通知
          express_phone: '18370381046', // 客户电话
          pickup_code: '2', //取件码
        },
      }),
    };
    // Mock.mock()
    return res.json(result);
  },
  'POST /CustomerService/innAccountInfo': (req: Request, res: Response) => {
    const result: ResponseItem = {
      code: 0,
      msg: '获取成功',
      data: {
        code: 0,
        msg: 'success',
        data: Mock.mock({
          account_info: {
            account: '13661964640',
            master: '无',
            register_at: '2019-03-05 14:47:18',
            cm_id: '1748871',
          },
          'brand|20': [
            {
              'id|+1': 1,
              'in_operate|1': ['仅入库', '仅出库'],
              out_operate: '不做操作',
              pda_no: '@natural',
              bind_info: '@natural',
              'brand|1': ['kj', 'kj', 'tt', 'dd'],
            },
          ],
        }),
      },
    };
    return res.json(result);
  },
  'POST /CustomerService/sendSmsCode': (req: Request, res: Response) => responseSuccess(req, res),
  'POST /CustomerService/closeInnAccount': (req: Request, res: Response) =>
    responseSuccess(req, res),
  'POST /SmsSensitiveWords/getSmsSensitiveWord': (req: Request, res: Response) => {
    return res.json({
      code: 0,
      msg: '成功',
      data: {
        word: '微信',
      },
    });
  },
  'POST /CustomerService/wayBillSearch': (req: Request, res: Response) => {
    return res.json({
      code: 0,
      msg: '\u6210\u529f',
      data: Mock.mock({
        'brand|1': ['中通', '申通', '圆通'],
        area: null,
        submitTime: '@now()',
        uploadTime: '@now()',
        status: null,
        failMsg: '',
        idCardName: '\u9e92\u545c',
        idCardNo: '3206**********0016',
        idCardTime: '2017-10-19 19:00:28',
        orderStatus: null,
        orderTime: '2019-04-15 15:21:11',
      }),
    });
  },
  'POST /CustomerService/payList': (req: Request, res: Response) => {
    return res.json({
      code: 0,
      msg: '成功',
      data: mock({
        kb_type: 's',
        username: '账号：',
        money: '支付金额：',
        available_money: '实际到账金额：',
        create: '时间：',
        order_number: '商户订单号：',
        trade_number: '流水号：',
        order_id: '订单号：',
        'pay_method_desc|1': ['微信', '支付宝', '微信免密'],
      }),
    });
  },
  'POST /CustomerService/cashList': (req: Request, res: Response) => {
    return res.json({
      code: 0,
      msg: '成功',
      data: {
        cash_number: '提现账户：',
        money: '金额：',
        available_money: '实际到账金额：',
        create: '时间：',
        order_number: '商户订单号：',
        trade_number: '流水号：',
      },
    });
  },
  'POST /CustomerService/smsSendSearch': (req: Request, res: Response) => {
    return res.json({
      code: 0,
      msg: '成功',
      data: {
        phone: '13512341234',
        list: [
          {
            inform_id: '123123123123',
            phone: '123123123123',
            informType: '入库通知',
            isSendSms: 't',
            isBlack: 't',
            shieldSendSms: 't',
            smsStatus: '接收成功',
            content: '什么什么的短信内容',
            sendType: '同时微信通知',
            push_tao: '0',
            push_wechat_result: '微信推送结果',
            push_huawei_result: '华为负一屏推送结果',
            create_time: '2020-22-10 16:66:66',
            account: '13512341234',
            smsSupplier: 'test',
            smsReportId: 1,
            smsReportTime: '2020-22-10 16:66:66',
            alipay_watch_time: '2020-22-10 16:66:66',
            has_outstorage: 't',
            huawei_watch_time: '2020-22-10 16:66:66',
            bh: '1234',
            dh: '1234',
            is_tao_dh: 'f',
          },
          {
            inform_id: '123123123123',
            phone: '',
            informType: '入库通知',
            isSendSms: 't',
            isBlack: 't',
            shieldSendSms: 't',
            smsStatus: '接收成功',
            content: '什么什么的短信内容',
            sendType: '同时微信通知',
            push_tao: '0',
            push_wechat_result: '微信推送结果',
            push_huawei_result: '华为负一屏推送结果',
            create_time: '2020-22-10 16:66:66',
            account: '13512341234',
            smsSupplier: 'test',
            smsReportId: 1,
            smsReportTime: '2020-22-10 16:66:66',
            alipay_watch_time: '2020-22-10 16:66:66',
            has_outstorage: 't',
            huawei_watch_time: '2020-22-10 16:66:66',
          },
        ],
      },
    });
  },
  'POST /CustomerService/cloudSms': (req: Request, res: Response) => {
    return res.json({
      code: 0,
      msg: '成功',
      data: {
        phone: '13512341234',
        list: [
          {
            wechat_status: 't',
            push_tao_status: '成功',
            has_outstorage: 't',
            phone: '13512341234',
            create_time: '2020-12-12 14:55:55',
            call_duration: '8',
            txt: '',
            call_status: '成功',
            call_id: '123123123123123123123123',
            cid: '123123123123123',
            supplier: 'kb',
            voice_path: '123123123123',
            user_type: '1',
            cm_info: '123123123123',
            shop_info: '123123123123123',
          },
          {
            wechat_status: 't',
            push_tao_status: '成功',
            has_outstorage: 't',
            phone: '13512341234',
            create_time: '2020-12-12 14:55:55',
            call_duration: '8',
            txt: '',
            call_status: '成功',
            call_id: '123123123123123123123123',
            cid: '123123123123123',
            supplier: 'kb',
            voice_path: '123123123123',
            user_type: '1',
            cm_info: '123123123123',
            shop_info: '123123123123123',
          },
        ],
      },
    });
  },

  'POST /CustomerService/GetDeliveryList': (req: Request, res: Response) => {
    return res.json(
      Mock.mock({
        code: 0,
        msg: '成功',
        data: {
          phone: '134888888888', //手机号
          cm_code: '123', //工号
          site_name: '测试', // 地址
        },
      }),
    );
  },
  'POST /CustomerService/checkReclaim': (req: Request, res: Response) => {
    return res.json(
      Mock.mock({
        'code|1': ['0', '1099'],
        msg: '抛错后展示接口接口msg',
        'data|1': [
          {
            back_cost: '0.00',
            back_time: '2020-20-12 14:66:66',
          },
          'date中返回字符串就直接展示',
        ],
      }),
    );
  },
  'POST /CustomerService/getWaybillFromNo': (req: Request, res: Response) => {
    return res.json(
      Mock.mock({
        'code|1': ['0', '1099'],
        msg: '抛错后展示接口接口msg',
        'data|1': [
          {
            bind_courier_no: '123123123123',
          },
          'date中返回字符串就直接展示',
        ],
      }),
    );
  },
  'POST /CustomerServiceV2/sms': (req: Request, res: Response) => {
    return res.json(
      mock({
        code: 0,
        msg: '成功',
        'data|30': [
          {
            'id|+1': 1,
            brand: 'sto',
            waybill: '123123213123',
            sms_type: '业务员通知',
            mobile: /\d{11}/,
            send_time: '@datetime',
            status: '发送失败-999-其它错误',
            sms_supplier: 'yitongdao',
            real_cnt: '2',
            content: '发往杭州的申通773164113504521已发出，详情：http://kd1.cn/rSMsiKn',
          },
        ],
      }),
    );
  },
  'POST /BasicInfo/syncZtCounterman': (req: Request, res: Response) => {
    res.send(
      mock({
        'code|1': ['1', '0'],
        'msg|1': 'magsjia sd as',
        data: {
          'phone|1': ['123123123123', ''],
        },
      }),
    );
  },
  'POST /CustomerServiceV2/getTrdBrand': (req: Request, res: Response) => {
    res.send(
      mock({
        code: 0,
        data: [
          {
            label: '全部',
            value: '',
          },
          {
            label: '极兔',
            value: 'jt',
          },
          {
            label: '京东',
            value: 'jd',
          },
        ],
        msg: 'success',
      }),
    );
  },
  'POST /CustomerServiceV2/queryTrdinfo': (req: Request, res: Response) => {
    res.send(
      mock({
        code: 0,
        msg: '成功',
        data: {
          logData: {
            queryLog: [
              {
                title: '查件',
                phone: '',
              },
              {
                title: '名址库查询',
                phone: '',
              },
              {
                title: '申通',
                phone: '',
              },
              {
                title: '兼容平台',
                phone: '',
              },
              {
                title: '短信第三方代发接口查询',
                phone: '183****4303',
                res: {
                  smsSupplier: 'pdd',
                  receivePhone: '183****4303',
                  readyForSendSms: true,
                  brand: 'yto',
                  waybillno: 'YT8598517847425',
                  sn: ['pdd'],
                  switch: {
                    zt: true,
                    yd: true,
                    pdd: true,
                    fw: true,
                    byte_star: true,
                    cnys: true,
                    jd_star: true,
                    jt_star: true,
                    yto_star: true,
                    sf_star: true,
                  },
                },
              },
              {
                title: '通讯录',
                phone: '',
              },
            ],
            setting: {
              is_open: true,
              sf_star: true,
              zt: true,
            },
            res: {
              title: '短信第三方代发接口查询',
              phone: '183****4303',
            },
          },
          supplierQuery: {
            byte_star: {
              name: '字节',
              phone: null,
              privacy: 0,
            },
            cnys: {
              name: '菜鸟',
              phone: '',
              privacy: 0,
            },
            fw: {
              name: '丰网',
              phone: '',
              privacy: 0,
            },
            pdd: {
              name: '拼多多',
              phone: '183****4303',
              privacy: 0,
            },
            jd_star: {
              name: '京东',
              phone: '',
              privacy: 0,
            },
            jt_star: {
              name: '极兔',
              phone: '',
              privacy: 0,
            },
            yd: {
              name: '韵达',
              phone: '',
              privacy: 0,
            },
            yto_star: {
              name: '圆通',
              phone: '',
              privacy: 0,
            },
            zt: {
              name: '中通',
              phone: '',
              privacy: 0,
            },
          },
        },
      }),
    );
  },
  'POST /CustomerService/accountOperationLog': (req: Request, res: Response) => {
    res.send(
      mock({
        code: 0,
        'data|4-5': [
          {
            create_time: '@now',
            content: '@cword(7, 10)',
          },
        ],
        msg: 'success',
      }),
    );
  },
};
